#include <iostream>
#include <vector>

using namespace std;
int n, m;
vector<int> a;

void dfs(int pos)
{
	if (a.size() == m)
	{
		for (auto x: a)
		{
			cout << x << " ";
		}
		cout << endl;
		return;
	}
	
	for (int i = pos; i <= n; i++)
	{
		a.push_back(i);
		
		dfs(i+1);
		
		a.pop_back();
	}
} 

int main()
{
	cin >> n >> m;
	dfs(1);
	
	return 0;
}
